<script lang="ts" setup>
import { PageConfigType, PageInfoType } from "#/antd-vue";

const props = withDefaults(
	defineProps<{
		pageConfig?: PageConfigType;
	}>(),
	{},
);

const pageInfo = defineModel<PageInfoType>("pageInfo");
</script>

<template>
	<a-pagination
		class="APagination"
		v-model:current="pageInfo!.current"
		v-model:pageSize="pageInfo!.pageSize"
		:hideOnSinglePage="props.pageConfig?.hideOnSinglePage ?? true"
		:total="pageInfo!.total"
		:simple="props.pageConfig?.simple"
		:showQuickJumper="props.pageConfig?.showQuickJumper"
		:showSizeChanger="props.pageConfig?.showSizeChanger"
		:pageSizeOptions="props.pageConfig?.pageSizeOptions"
		:showTotal="props.pageConfig?.showTotal ?? ((total: number) => `共 ${total} 条`)"
		@change="props.pageConfig?.change"
		@showSizeChange="props.pageConfig?.showSizeChange"
	/>
</template>
<style scoped></style>
